package com.infore.dataAudit.util;

import java.io.File;
import java.util.Properties;

/**
 * activiti流程配置工具类
 * 
 * @author Administrator
 *
 */
public class ActivitiProcessUtil {

    private static Properties p = new Properties();

    static {
        try {
            p.load(ActivitiProcessUtil.class.getClassLoader()
                    .getResourceAsStream("processes" + File.separator + "processDeploy.properties"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String getValue(String key) {
        String value = p.getProperty(key);
        return value==null?Constants.NULL_STRING:p.getProperty(key);
    }
    /**
     * 不存在或isNaN时返回null
     * 
     * @author 蒋恒涛
     * @return Integer
     * @param key
     * @date 2018年6月22日上午11:33:27
     */
    public static Integer getIntegerValue(String key) {
        String value = p.getProperty(key);
        if(value == null) {
            return null;
        }
        
        try {
            return Integer.valueOf(value);
        } catch (NumberFormatException e) {
            return null;
        }
    }
}
